import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.function.Consumer;

public class ConsumerDemo2 {
    public static void main(String[] args) {
        String [] arr = {"Jack,22","Mary,21","Tom,23"};
        printInfo(arr,
        s-> System.out.print("name : " + s.split(",")[0] + " , "),
       // s-> System.out.println("age : " + s.split(",")[1]));
        s-> System.out.println("age : " + Integer.parseInt(s.split(",")[1])));
    }
    private static void printInfo(String[] info, Consumer<String> con1, Consumer<String> con2){
        for(String str : info)
            con1.andThen(con2).accept(str);
    }
}
